package cn.id68.www.http.builder;

import java.util.LinkedHashMap;
import java.util.Map;

import cn.id68.www.http.RequestCall;

/**
 * Created by Administrator on 2017/3/20.
 */
public abstract class OkHttpRequestBuilder<T extends OkHttpRequestBuilder> {

    protected String url;
    protected Object tag;
    protected Map<String,String> headers;
    protected Map<String,String> params;
    protected int id;

    public T id(int id){
        this.id = id;
        return (T) this;
    }
    public T url(String url){
        this.url = url;
        return (T) this;
    }

    public T tag(Object tag){
        this.tag = tag;
        return (T) this;
    }

    public T headers(Map<String,String> headers){
        this.headers = headers;
        return (T) this;
    }
    public T addHeader(String key,String val){
        if (headers == null){
            headers = new LinkedHashMap<>();
        }

        headers.put(key,val);
        return (T) this;
    }


    public  abstract RequestCall build();

}
